trichview.com

trichview.support




[Fwd: CSS ... why not ? (long)]


Return to index


Author

Message

Stef Mientki

Posted: 09/25/2003 0:21:22


hi,


Why is CSS importing not yet supported ?

Ok sergey, I know it's third party, but I think a lot of people (like

me) would love it (and you already modified the htmlimporter code ;-).


With the help of Chris Greenshaw (THANKS !) and after a few evenings of

strugling through the code, I found a very simple solution, ....

.... or I'm overseeing a lot of difficulties ??


Let me first explain why I want/need CSS.

What I want is creating a editor, with the following specs:

- supports RVF and HTML formats

- styles are always fixed, that is, they can be definied by the user,

but every document, whether RVF or HTML, has the same textstyle=2

- if a style is redefined by the user all documents should popup in the

new style

- I don't want to store 2 files (a RVF file and a exported html file)


To accomplish this, (RVF is no problem), I've chosen for HTML with CSS

(I don't know any other method).

Exporting from RVE, with SaveHTMLEx works perfect.

Importing of these HTML files, looses all style information, at least

they are bound to the fixed styles in my editor.

There are some CSS importers, but I can't get them to work well.


Now by adding about 25 lines of code (of which 20 are copied) in to

htmlimporter, it seems I finally can import these "by-RVE-exported-html"

files. (See the code below).

Can anyone point me if this code is correct,

or tell me what I'm overseeing ?

If this code is ok, (before struggling another few evenings),

is there an equal simple solution to insert the paragraph and list styles ?


thanks,

Stef Mientki



For the textstyles, in TRvHtmlImporter.LoadHtml

I inserted a modified copy of tags 'font' and '/font'

It asssumes:  <span class="RVTS8"

extracts the number of the textstyle (8 in this case) and then sets that

style.


               else if s = '/span' then

               begin

                 WriteTSCR;

                 if CurContainer.PrevFont.Count > 0 then

                 begin

                   CurrStyle :=

longint(CurContainer.PrevFont[CurContainer.PrevFont.Count - 1]);


CurContainer.PrevFont.Delete(CurContainer.PrevFont.Count - 1);

                   FViewer.Style.TextStyles[CurrStyle].AssignTo(CF);

                 end;

               end

               else if s = 'span' then

               begin

                 WriteTSCR;

                 s := gv(Parser.TagParams, 'class');

                 s:=copy(s,5,length(s)-4);

                 i:=strtointdef(s,0);

                 if i>Fviewer.Style.TextStyles.Count-1 then i:=0;

                 CF.assign(FViewer.Style.TextStyles[i]);

                 if RVData <> nil then

                 begin

                   CurContainer.PrevFont.Add(Pointer(CurrStyle));

                   with FViewer.Style.TextStyles do

                   begin

                     CurrStyle := I;

                   end;

                 end;

               end






Powered by ABC Amber Outlook Express Converter